@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
  color-scheme: light dark;

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  --td-brand-color: #000000;
  --td-brand-color-active: #111111;
  --td-brand-color-hover: #666666;
  --td-brand-color-focus: #333333;
  --main-bg-color: #ffffff;
  --main-font-color: #333333;

  --td-radius-default: 32px;
}

:root[theme-mode="light"] {
  --td-brand-color: #000000;
  --td-brand-color-active: #111111;
  --td-brand-color-hover: #666666;
  --td-brand-color-focus: #f5f5f5;
  --td-brand-color-light: #f5f5f5;
  --main-bg-color: #ffffff;
  --main-font-color: #333333;
}

:root[theme-mode="dark"] {
  --td-brand-color: #000000;
  --td-brand-color-active: #111111;
  --td-brand-color-hover: #666666;
  --td-brand-color-focus: #333333;
  --main-bg-color: #000000;
  --main-font-color: #cccccc;

  ::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(255, 255, 255, .1) !important;
  }
}

html, body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background-color: var(--main-bg-color);
  scrollbar-color: #8e9099 transparent;
  
  overflow-x: hidden;
  overflow-y: auto;
}

:root[theme-mode="dark"] {
  scrollbar-color: #8e9099 transparent;
}

.markdown-body {
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 auto;

  .code-block-container {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 0.75rem;
    overflow: hidden;
    margin: 1rem 0;
    .code-block-header {
      background-color: #f5f5f5;
      padding: 0.5rem 1rem;
      border-bottom: 1px solid #e5e5e5;
      font-weight: 600;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .code-block-icon {
        display: inline-block;
        width: 0.5rem;
        height: 0.5rem;
        margin-right: 0.4rem;
        border: 2px solid #666666;
        border-radius: 50%;
      }
    }
  }

  // Styles for collapsible code blocks
  .code-block-container.collapsible .code-block-body {
    max-height: 240px;
    overflow: hidden;
    position: relative;
  }

  .code-block-container.collapsible.collapsed .code-block-body {
    max-height: none;
  }

  .code-block-container.collapsible .code-block-body::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent 0%, rgba(255,255,255,0.8) 60%, white 100%);
    pointer-events: none;
    border-bottom: 2px solid #e5e5e5;
  }

  .code-block-container.collapsible.collapsed .code-block-body::after {
    display: none;
  }

  .code-block-toggle {
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    background: none;
    border: 1px solid #e5e5e5;
    border-radius: 0.25rem;
    svg {
      width: 16px;
      height: 16px;
      color: #666666;
    }
  }

  .code-block-container:not(.collapsed) .expand-icon,
  .code-block-container.collapsed .collapse-icon {
    display: none;
  }

  pre {
    background-color: #ffffff!important;
    margin-bottom: 0!important;
    &>code.language-text {
      white-space: pre-wrap!important;
      word-wrap: break-word!important;
      overflow-wrap: break-word!important;
    }
  }

  hr {
    background-color: #f5f5f5;
  }


  :root[theme-mode="dark"] & {
    color: var(--main-font-color);
    background-color: transparent;

    .code-block-container {
      background-color: #111111;
      border: 1px solid #333333;
      border-radius: 0.75rem;
      overflow: hidden;
      margin: 1rem 0;
      .code-block-header {
        background-color: #111111;
        padding: 0.5rem 1rem;
        border-bottom: 1px solid #333333;
      }
    }

    .code-block-toggle {
      border: 1px solid #333333;
      svg {
        color: #999999;
      }
    }

    .code-block-container.collapsible .code-block-body::after {
      background: linear-gradient(transparent 0%, rgba(17,17,17,0.8) 60%, #111111 100%);
      border-bottom: 2px solid #333333;
    }

    pre {
      background-color: #111111!important;
      border: 1px solid rgba(229, 229, 229, 0.1)!important;

      code {
        color: #999999;
      }

      ::selection {
        background-color: #333333;
      }
    }

    hr {
      background-color: rgba(229, 229, 229, 0.1);
    }

    table {
      tr {
        background-color: rgba(229, 229, 229, 0.2);
        border-top: 1px solid rgba(229, 229, 229, 0.1);

        &:nth-child(2n) {
          background-color: rgba(229, 229, 229, 0.1);
        }
      }

      th, td {
        border: 1px solid rgba(229, 229, 229, 0.1);
      }
    }
  }
}

a {
  text-decoration: none;
}

.t-textarea__inner {
  border-radius: 3px;
}

div {
  border-width: 0px;
  border-style: solid;
}

#app {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
